import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Admin
 * Date: 2022-11-11
 * Time: 20:21
 */
public class Demo3 {

    static class Node {
        int val;
        Node next;

        public Node(int val) {
            this.val = val;
        }
    }
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n  = scan.nextInt();
        scan.nextLine();

        String str1 = scan.nextLine();
        String[] arr1 = str1.split(" ");


        Node head = new Node(-1);
        Node cur = head;
        for (int i = 0; i < n; i++) {
            int value = Integer.parseInt(arr1[i]);
            Node node = new Node(value);
            cur.next = node;
            cur = node;
        }

        String str2 =scan.nextLine();
        String[] arr2 = str2.split(" ");
        int left = Integer.parseInt(arr2[0]);
        int right = Integer.parseInt(arr2[1]);
        Node newHead = func(head.next,left,right);

        while(newHead != null) {
            System.out.println(newHead.val + " ");
            newHead = newHead.next;
        }

    }

    public static Node func(Node node, int left, int right) {
        Node head = new Node(-1);
        head.next = node;
        Node cur = head;

        for(int i = 1; i < left; i++) {
            cur = cur.next;
        }

        //反转区间的起始节点
        Node prev = cur.next;
        for (int i = left; i < right; i++) {
            Node third = prev.next;
            prev.next = third.next;

            third.next = cur.next;
            cur.next = third;
        }

        return head.next;
    }
}
